package ltd.bugs.cute.web.exception;

import ltd.bugs.cute.api.http.statuscode.StatusCode;

/**
 * 业务异常
 * 
 * @author zhengzhq
 *
 */
public class BizException extends RuntimeException {

  private static final long serialVersionUID = -2439886685902987723L;

  private int code;
  private String message;
  private String extraMessage;

  public BizException(StatusCode statusCode) {
    super(statusCode.message());
    this.code = statusCode.code();
    this.message = statusCode.message();
  }

  public BizException(StatusCode statusCode, String extraMessage) {
    this(statusCode);
    this.extraMessage = extraMessage;
  }

  public int getCode() {
    return code;
  }

  public String getMessage() {
    return message;
  }

  public String getExtraMessage() {
    return extraMessage;
  }
}
